package com.knightcloud.micro.upms.controller;

import com.knightcloud.common.base.vo.response.R;
import com.knightcloud.micro.upms.api.dto.SysUserDto;
import com.knightcloud.micro.upms.api.dto.SysUserInfoDto;
import com.knightcloud.micro.upms.service.ISysUserService;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * upms内部控制器
 *
 * @author knight
 */
@RestController
@RequestMapping("/inner")
@RequiredArgsConstructor
public class UpmsInnerController {

	/**
	 * 系统用户服务
	 */
	private final ISysUserService sysUserService;

	@Operation(description = "根据用户名查询系统用户")
	@GetMapping("/user/username")
	public R<SysUserDto> selectSysUserDtoByUsername(@RequestParam("username") String username) {
		return sysUserService.selectSysUserDtoByUsername(username);
	}

	@Operation(description = "根据用户名查询系统用户信息")
	@GetMapping("/user/info/username")
	public R<SysUserInfoDto> selectSysUserInfoDtoByUsername(@RequestParam("username") String username) {
		return sysUserService.selectSysUserInfoDtoByUsername(username);
	}

}
